home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6992 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.6 KB  |  79 lines

  1. Path: news.mindlink.net!news
  2. From: genew@mindlink.bc.ca (Gene Wirchenko)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: C constant expression declarations
  5. Date: Sat, 17 Feb 1996 02:02:25 GMT
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Message-ID: <4g3d46$65h@fountain.mindlink.net>
  8. References: <31229735.41C67EA6@isi.com> <4fvl5cINN94q@keats.ugrad.cs.ubc.ca> <4g2nha$ksa@sun001.spd.dsccc.com>
  9. NNTP-Posting-Host: line161.nwm.mindlink.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. jmccarty@spd.dsccc.com (Mike McCarty) wrote:
  13.  
  14. >In article <4fvl5cINN94q@keats.ugrad.cs.ubc.ca>,
  15. >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  16. >)In article <31229735.41C67EA6@isi.com>, J.R. Stoner <jstoner@isi.com> wrote:
  17. >)>This is a query (I have checked the FAQ) into something that strikes me
  18. >)>as a dumbfoundedly stupid issue, but I will ask it anyway :)
  19. >)>
  20. >)>Normally, I will do things such as:
  21. >)>
  22. >)> #define EXPR1   1
  23. >)> #define EXPR2   2
  24. >)>
  25. >)>...and so on.  Lately, I have been observing in code from other people
  26. >)>equivalent declarations such as:
  27. >)>
  28. >)> #define EXPR1   (1)
  29. >)> #define EXPR2   (2)
  30. >)
  31. >)This does not buy you anything at all, since the thing you are bracketing
  32. >)has only one constituent: it's not a compound expression.
  33.  
  34.      Just say that it's silly as is the lawyer-speak: four (4).
  35.  
  36. >I respectfully disagree with this statement. It buys two very important
  37. >things, to wit:
  38.  
  39. >    it builds a good habit of putting parens in, so that when they
  40. >        are needed they don't inadvertently get left out
  41.  
  42.      If they aren't needed, why is it a good habit?  Would it not
  43. create bad habits by making programmers not bother to learn when
  44. parens are and aren't necessary?
  45.  
  46. >    it builds consistency, so that one gets a feeling that
  47. >        "something may be wrong here" when inspecting code for
  48. >        errors 
  49.  
  50.      As in there are too many parens <G>?
  51.  
  52. >I believe that (for the sake of creating and maintaining correct
  53. >programs) these are well worth the extra discipline (at first) and
  54. >compilation time for the cases where the parens are not strictly needed.
  55.  
  56.      Unfortunately, it can lead someone off into the tulies.  I have
  57. heard
  58.           return (0);
  59. explained as calling the return function.  I think the extra
  60. discipline should be put into learning the syntax's associated
  61. semantics.
  62.  
  63. >Mike
  64. >----
  65. >char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
  66.  
  67. >I don't speak for DSC.         <- They make me say that.
  68.                                       ^
  69.      I've always loved your sig.  <snicker>
  70.  
  71. Sincerely,
  72.  
  73. Gene Wirchenko
  74.  
  75. C Pronunciation Guide:
  76.      y=x++;     "wye equals ex plus plus semicolon"
  77.      x=x++;     "ex equals ex doublecross semicolon"
  78.  
  79.